<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新增字典类型</title>
    <link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css" media="all"/>
    <!--公用样式-->
    <link rel="stylesheet" href="${re.contextPath}/plugin/common/css/comment.css">
    <!--页面样式-->
    <link rel="stylesheet" href="${re.contextPath}/plugin/common/css/style.css">
    <link rel="stylesheet" href="${re.contextPath}/plugin/common/css/extended.css">
    <script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"></script>
    <script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/comment.js"></script>
    <style>
        .layui-inline{
            width: 47%;
        }
        .layui-inline lebel {
            width: 30% !important;
        }
        .layui-input-inline {
            width: 45% !important;
        }
        .layui-input-inline input{
            width: 100%;
        }
        .layui-form-label{
            width: 30% !important;
        }
    </style>
</head>
<body class="whitebg">


<div class="layui-form-item" style="padding: 20px 10px 20px 40px">
    <div class="layui-inline">
        <label class="layui-form-label"><span class="red">*</span>序号</label>
        <div class="layui-input-inline">
            <input type="number" name="badtIndex" id="badtIndex" value="${baseDict.badtIndex}" lay-verify="badtIndex" autocomplete="off" class="fl" placeholder="请输入序号">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label"><span class="red">*</span>编号</label>
        <div class="layui-input-inline">
            <input type="text" name="badtCode" id="badtCode" value="${baseDict.badtCode}" disabled lay-verify="dictTypeCode" autocomplete="off" class="fl" placeholder="请输入字典编号">
            <input type="hidden" name="badtNo" id="badtNo" lay-verify="dictTypeCode" autocomplete="off" class="fl" placeholder="请输入字典编号" value="${baseDict.badtNo}">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label"><span class="red">*</span>名称</label>
        <div class="layui-input-inline">
            <input type="text" name="badtName" id="badtName" value="${baseDict.badtName}" lay-verify="dictTypeCode" autocomplete="off" class="fl" placeholder="请输入字典名称">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label"><span class="red">*</span>科室代码</label>
        <div class="layui-input-inline">
            <input type="text" name="badtGroupid" id="badtGroupid" value="${baseDict.badtGroupid}" lay-verify="dictTypeName" autocomplete="off" class="fl" placeholder="请输入科室代码">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">
            <span id="levalName1">等级1</span>
        </label>
        <div class="layui-input-inline">
            <input type="text" name="badtLevel1" id="badtLevel1" value="${baseDict.badtLevel1}" lay-verify="dictTypeName" autocomplete="off" class="fl" placeholder="请输入等级1">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label"><span id="levalName2">等级2</span></label>
        <div class="layui-input-inline">
            <input type="text" name="badtLevel2" id="badtLevel2" value="${baseDict.badtLevel2}" lay-verify="dictTypeName" autocomplete="off" class="fl" placeholder="请输入等级2">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label"><span id="levalName3">等级3</span></label>
        <div class="layui-input-inline">
            <input type="text" name="badtLevel3" id="badtLevel3" value="${baseDict.badtLevel3}" lay-verify="dictTypeName" autocomplete="off" class="fl" placeholder="请输入等级3">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label"><span id="levalName4">等级4</span></label>
        <div class="layui-input-inline">
            <input type="text" name="badtLevel4" id="badtLevel4" value="${baseDict.badtLevel4}" lay-verify="dictTypeName" autocomplete="off" class="fl" placeholder="请输入等级4">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label"><span id="levalName5">等级5</span></label>
        <div class="layui-input-inline">
            <input type="text" name="badtLevel5" id="badtLevel5" value="${baseDict.badtLevel5}" lay-verify="dictTypeName" autocomplete="off" class="fl" placeholder="请输入等级5">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label"><span id="levalName6">等级6</span></label>
        <div class="layui-input-inline">
            <input type="text" name="badtLevel6" id="badtLevel6" value="${baseDict.badtLevel6}" lay-verify="dictTypeName" autocomplete="off" class="fl" placeholder="请输入等级6">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label"><span id="levalName7">等级7</span></label>
        <div class="layui-input-inline">
            <input type="text" name="badtLevel7" id="badtLevel7" value="${baseDict.badtLevel7}" lay-verify="dictTypeName" autocomplete="off" class="fl" placeholder="请输入等级7">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label"><span id="levalName7">等级8</span></label>
        <div class="layui-input-inline">
            <input type="text" name="badtLevel8" id="badtLevel8" value="${baseDict.badtLevel7}" lay-verify="dictTypeName" autocomplete="off" class="fl" placeholder="请输入等级8">
        </div>
    </div>
    <div class="layui-inline" id="sc">
        <label class="layui-form-label"><span id="levalName11">允许上传的角色</span></label>
        <div class="layui-input-inline">
            <input type="text" name="badtLevel11" id="badtLevel11" value="${baseDict.badtLevel11}" lay-verify="dictTypeName" autocomplete="off" class="fl" placeholder="允许上传的角色">
        </div>
    </div>
    <div class="layui-inline" id="bj">
        <label class="layui-form-label"><span id="levalName13">允许编辑的角色</span></label>
        <div class="layui-input-inline">
            <input type="text" name="badtLevel13" id="badtLevel13" value="${baseDict.badtLevel13}" lay-verify="dictTypeName" autocomplete="off" class="fl" placeholder="允许编辑的角色">
        </div>
    </div>
    <div class="layui-inline" id="dc">
        <label class="layui-form-label"><span id="levalName13">允许导出的角色</span></label>
        <div class="layui-input-inline">
            <input type="text" name="badtLevel14" id="badtLevel14" value="${baseDict.badtLevel14}" lay-verify="dictTypeName" autocomplete="off" class="fl" placeholder="允许导出的角色">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-inline">
            <input type="text" name="badtNote" id="badtNote" value="${baseDict.badtNote}" lay-verify="dictTypeName" autocomplete="off" class="fl" placeholder="请输入备注">
        </div>
    </div>

</div>

<div style="background-color: white;background-color: white;padding: 15px;text-align: center;position: fixed;bottom: 1px;width: 100%;">
    <button class="layui-btn layui-btn-sm" lay-filter="submitType" lay-submit type="button">更新</button>
    <button class="layui-btn layui-btn-primary layui-btn-sm" type="button" id="close">取消</button>
</div>

<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
<script>
    $.ready=function(){
        $("#sc").hide();
        $("#bj").hide();
        $("#dc").hide();
        if(localStorage.getItem("currDictTypeData")){
            var dictTypeData = JSON.parse(localStorage.getItem("currDictTypeData"));
            if(dictTypeData.dictTypecode=='WJ001'){
                $("#sc").show();
                $("#bj").show();
                $("#dc").show();
            }
            for(var i=1;i<8;i++){
                var currLevelName = '';
                eval("currLevelName=dictTypeData['dictLevel'+i+'Name']");
                if(currLevelName){
                    $("#levalName"+i).text(currLevelName);
                    $("#badtLevel"+i).attr('placeholder',"请输入"+currLevelName);
                }else{
                    $("#levalName"+i).text('等级'+i);
                    $("#badtLevel"+i).attr('placeholder',"请输入等级"+i);
                }
            }
        }
    }
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;

        $('#close').click(function(){
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        });
        //监听提交

        form.on('submit(submitType)', function(data){
            if(!$('#badtCode').val()){
                layer.msg('请输入字典编号',{icon:2});
                return ;
            }
            if(!$('#badtName').val()){
                layer.msg('请输入字典名称',{icon:2});
                return ;
            }
            var json = {
                badtNo: $('#badtNo').val().replace(",",""),
                badtCode: $('#badtCode').val(),
                badtName:  $('#badtName').val(),
                badtGroupid:  $('#badtGroupid').val(),
                badtLevel1:  $('#badtLevel1').val(),
                badtLevel2:  $('#badtLevel2').val(),
                badtLevel3:  $('#badtLevel3').val(),
                badtLevel4:  $('#badtLevel4').val(),
                badtLevel5:  $('#badtLevel5').val(),
                badtLevel6:  $('#badtLevel6').val(),
                badtLevel7:  $('#badtLevel7').val(),
                badtLevel11:  $('#badtLevel11').val(),
                badtLevel13:  $('#badtLevel13').val(),
                badtLevel14:  $('#badtLevel14').val(),
                badtNote:  $('#badtNote').val(),
                badtIndex:  $('#badtIndex').val(),
            }
            layerAjax('/sys/dict/updateDictValue',json, '',
                function (d) {
                    if (d.flag == true) {
                        // parent.flushDictList();
                        parent.layer.msg('操作成功', {icon: 1});
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                        parent.flushDictList();
                    } else {
                        layer.msg(d.msg, {icon: 2});
                    }
                });
            return false;
        });
    });
</script>
</body>
</html>